#!/usr/bin/perl
#
# Get a bounce message to the Linux Counter
# For now, create a file in "temp/bounces"
#
use POSIX;

$spooldir = "/home/counter/email/bounces";
chdir($spooldir);
$n = 0;
while (1) {
    ++ $n;
    $file = "in.$$.$n";
    sysopen(OUT, $file, O_RDWR|O_CREAT|O_EXCL, 0770) && last;
    die "Non-clash error: $!" if $! != EEXIST;
}
while (<>) {
    print OUT;
}

